home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 5
/
The 640 Meg Shareware Studio CD-ROM Volume V (Data Express)(1994).ISO
/
amiga
/
tempdemo.lha
/
ProgrammersInfo
/
Nuke.mod.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-22
|
19KB
|
734 lines
/*
NUKE MODULE v1.0
(NUKE KILLER : TEMPEST FAKER)
[NUKE Module v_._] [Tempest Faker] By The SkeletoN [__-__-__]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Return = Quit] Conference Number:
[Return = None] File Number:
CONFERENCE [2:AMIGA WAREZ]
# File Name Date Size Description
===============================================================================
403 12345678.DMS 07-13-92 1403000:Junk / Fake / Old / Renamed / Shit
:
:
:
:
:
:
Listing Stats: Offline :
Drive Stats: Deleted [UPLOADER]
===============================================================================
1 : Remove from Catalog & Take Credits 5 : Macros for Date field
2 : Delete from Drive & Take Credits 6 : Macros for Last description line
3 : From Catalog, Drive & Take Credits - : Leave Warning to Uploader
4 : Take credits only - : Give credits back to downloaders
[Return = None] Select [1-6]:
Remove Credits? [Return = No] [1x-9x]:
[ The Skeleton] Old Stats: 1,000,000,000 UL Bytes | 1000 # Uploads
- 100,000,000 Bytes | 50 Uploads
=========================|===============
New Stats: 900,000,000 UL Bytes | 950 # Uploads
[Return = None] File Number:
===============================================================================
Quick Macros [For Date]
===============================================================================
1: -Deleted | 3: -Ancient | 5: -NoPacks | 7: =Broken= | 9: ==Nuked=
2: =Slayed= | 4: -Offline | 6: ==Fake== | 8: -Renamed | 0: =Banned=
===============================================================================
[--/--/--] For Date Field
Enter Text or Macro Number:
*/
//**********************
//***** Includes *****
//**********************
#include <proto/all.h>
#include <stdio.h>
#include <string.h>
#include <tempest/headers.h>
#include <skeleton/commas.h>
//********************************
//***** Structures/Defines *****
//********************************
struct MyMessage
{
struct Message Msg;
struct User User;
char text[255];
char text1[255];
int car,Value,Data;
long LongValue;
int IntValue;
};
struct User User;
struct User User1;
struct MsgPort *MyPort = NULL;
struct MyMessage *msg;
struct Catalog Catalog;
struct SystemData SystemData;
struct File_Area File_Area[41]; /* To Read Files.Data */
#define DROP if(EXIT_FLAG) CloseStuff();
void CloseStuff();
void GetStr(char s[],int opt);
void input(char mstring[],int len);
int DOORIO();
void TakeCredits(void);
int FindUserSlot(void);
void GetFileInfo(int ,int );
void LoadUserSlot(int);
void SaveUserSlot(int);
int EXIT_FLAG, DOOR_DATA, DOOR_CAR, DOOR_VALUE, DOOR_VALUE1 = 0,first = 0;
int in,out;
char DOOR_MSG [255],DOOR_MSG1[255],MyName[255],st[100];
char string1[255],string2[255],string3[255],border[100];
int Conference,FileNumber,fd,stat,c,i=0;
void Activity(BYTE);
void SetValue(int, int);
char DateMacros[10][9] = { "-Deleted","==Nuked=","-Ancient","-Offline","-NoPacks",
"==Fake==","=Broken=","-Renamed","Very olD","=Banned=" };
char LineMacros[5][35] = { "=***= FAKE =***=","=***= Very olD =***=",
"=***= NOT ALLOWED =***=","=***= DUPLICATE UPLOAD =***=" };
/*****************************/
/***** PL (Print Line) *****/
/*****************************/
void pl(fmt,a1,a2,a3,a4,a5,a6)
char *fmt;
{
char s[255];
sprintf(s,fmt,a1,a2,a3,a4,a5,a6);
DOOR_DATA=1; strcpy(DOOR_MSG,s); DOORIO();
}
//***********************
//***** SYSOP-LOG *****
//***********************
void SLOG(fmt,a1,a2,a3,a4,a5,a6)
char *fmt;
{
char s[255];
sprintf(s,fmt,a1,a2,a3,a4,a5,a6);
DOOR_DATA=61; strcpy(DOOR_MSG,s); DOORIO();
}
//******************
//***** Main *****
//******************
void main(int argc,char *argv[])
{
char DataPath[255];
int x;
if(!DoorStart(argv[1])) { puts("Tempest Door!\n"); exit(0); }
Activity(26);
SetValue(1,3);
//********************************
//***** Load Internal.Data *****
//********************************
GetStr(DataPath,0);
sprintf(string1,"%sSetup/SystemData.DATA",DataPath);
fd=Open(string1,MODE_OLDFILE);
if(fd==0) CloseStuff();
Read(fd,(char *)&SystemData, sizeof(struct SystemData));
Close(fd);
//****************************
//***** Load File.Data *****
//****************************
sprintf(string2,"%sSetup/Files.DATA",DataPath);
fd=Open(string2,MODE_OLDFILE);
do
{
Read(fd,(char *)&File_Area[i], sizeof(struct File_Area));
i++;
}
while(i<40);
Close(fd);
//*************************
//***** The Heading *****
//*************************
// pl("\r\n\r\n
[
NUKE Module v0.8
]
[
Tempest Faker
]
By Michael Bockert
[
02-01-94
]\r\n");
// pl("
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n");
//*************************************
//***** Enter Conference Number *****
//*************************************
CONFERENCE:
/*
strcpy(string1,"");
pl("\r\n
[
Return = Quit
]
Conference Number:
");
input(string1,2);
if(string1[0] == NULL)
{
pl("\r\n\r\n");
CloseStuff();
}
Conference = atoi(string1);
*/
Conference = User.FB_J;
//*******************************
//***** Enter File Number *****
//*******************************
FILENUMBER:
strcpy(string1,"");
pl("\r\n
[
Return = Abort
]
Kill Files, Enter File Number:
");
input(string1,5);
if(string1[0] == NULL) CloseStuff();
FileNumber = atoi(string1);
//******************************
//***** Get Catalog Info *****
//******************************
GetFileInfo(Conference,FileNumber);
if(Catalog.Flags & 0x08)
{
pl("\r\nThis file is protected from deletion!");
goto FILENUMBER;
}
//***********************
//***** Kill Menu *****
//***********************
KILLMENU:
strcpy(border,"
===============================================================================");
pl("\f
CONFERENCE
[
%d
:
%s
]\r\n\r\n",Conference,File_Area[Conference].Name);
pl("
No. File Name Date Size Description\r\n");
pl("%s\r\n",border);
pl("%4d
%-12s
%8s
%7ld
:
%-s\r\n",
FileNumber,Catalog.FileName,Catalog.DateU,Catalog.Bytes,Catalog.Line[0]);
for(x=1;x<11;x++)
{
pl("
:
%-s\r\n",Catalog.Line[x]);
}
if(Catalog.Flags & 0x01) strcpy(string2,"Online");
else strcpy(string2,"Offline");
pl("
Listing Status
:
%7s
:
%-s\r\n",string2,Catalog.Line[11]);
pl("
Drive Status
:
[
%s
]\r\n",Catalog.Uploader);
pl("%s\r\n",border);
pl("
1
:
Remove from Catalog / Take Credits
5
:
Macros for Date Field\r\n");
pl("
2
:
Delete from Drive / Take Credits
6
:
Macros for Last description line\r\n");
pl("
3
:
From Catalog, Drive / Take Credits
-
:
Leave Warning to Uploader\r\n");
pl("
4
:
Take credits only
-
:
Give credits back to downloaders\r\n\r\n");
pl("
[
Return = None
]
Select
[
1-6
]:
");
input(string1,1);
//*****************
//***** 1-4 *****
//*****************
c=atoi(string1);
if(c == 0) goto FILENUMBER;
if((c > 0) && (c < 5))
{
if((c==1) || (c==3))
{
Catalog.Flags &=~0x01;
// sprintf(string,"%s%s.Dsc-%d",SystemData.MSG,Catalog.FileName,Conference);
// DeleteFile(string);
Catalog.Flags &=~0x04; // ExtDesc=0
}
if((c == 2) || (c == 3))
{
Catalog.Flags |= 0x20;
strcpy(string1,Catalog.FileName);
x=OnlineFile(Conference,string1);
if(x==0) pl("File (%s) was not found.\r\n",string1);
else
{
AGAIN:
pl("\r\n(D)elete File, (L)ock out & Delete, (A)bort [D,L,A]? ");
input(string2,1);
string2[0]=toupper(string2[0]);
switch(string2[0])
{
case 'A': break;
case 'L': fd=Open(string1,MODE_NEWFILE);
Close(fd);
break;
case 'D': DeleteFile(string1); break;
default: goto AGAIN;
}
if(string2[0]!='A')
{
strcpy(string1,Catalog.FileName);
sprintf(string2,"[Killed off Disk]: %s\n",string1);
pl("\r%s\r",string2);
SLOG(string2);
}
}
}
SaveFileSlot(Conference,FileNumber);
TakeCredits();
goto FILENUMBER;
}
else
{
//*****************************
//***** Macros For Date *****
//*****************************
if(c == 5)
{
pl("\r\n\r\n%s\r\n",border);
pl("
Quick Macros [For Date]\r\n");
pl("%s\r\n",border);
pl("0:
%s
2:
%s
4:
%s
6:
%s
8:
%s\r\n",
DateMacros[0],DateMacros[2],DateMacros[4],DateMacros[6],DateMacros[8]);
pl("1:
%s
3:
%s
5:
%s
7:
%s
9:
%s\r\n",
DateMacros[1],DateMacros[3],DateMacros[5],DateMacros[7],DateMacros[9]);
pl("%s\r\n\r\n",border);
pl("
[--/--/--]\r\n");
pl("
Enter Text or Macro Number
: ");
input(string1,8);
if(string1[0] == NULL)
goto KILLMENU;
if(string1[1] != NULL)
strcpy(Catalog.DateU,string1);
else
{
i = atoi(string1);
strcpy(Catalog.DateU,DateMacros[i]);
}
SaveFileSlot(Conference,FileNumber);
goto KILLMENU;
}
else
{
//**********************************
//***** Macros For Last Line *****
//**********************************
if(c == 6)
{
pl("\r\n\r\n%s\r\n",border);
pl("
Quick Macros [For Last Line Description]\r\n");
pl("%s\r\n",border);
pl("0:
%s\r\n",LineMacros[0]);
pl("1:
%s\r\n",LineMacros[1]);
pl("2:
%s\r\n",LineMacros[2]);
pl("3:
%s\r\n",LineMacros[3]);
pl("%s\r\n\r\n",border);
pl("
[----*----|----*----|----*----|----+----*----]\r\n");
pl("
Enter Text or Macro Number
: ");
input(string1,44);
if(string1[0] == NULL) goto KILLMENU;
if(string1[1] == NULL)
{
i = atoi(string1);
if(i>1) strcpy(Catalog.Line[11],LineMacros[i]);
}
else strcpy(Catalog.Line[11],string1);
SaveFileSlot(Conference,FileNumber);
goto KILLMENU;
}
}
}
goto FILENUMBER;
}
//**************************
//***** Take Credits *****
//**************************
void TakeCredits(void)
{
int Credits,UserSlot;
long CreditBytes;
pl("\r\n\r\n
Remove Credits?
[
Return = No
] [
1x-9x
]:
");
input(string1,1);
if((string1[0] == NULL) || (string1[0] == 'n') || (string1[0] == 'N'))
return;
Credits = atoi(string1);
UserSlot = FindUserSlot();
if(UserSlot == -1)
{
pl("\r\nHandle not found in accounts!\r\n");
return;
}
LoadUserSlot(UserSlot);
if(Credits < 1) // Minimum Safty Check
Credits = 1;
pl("\r\n
[
%25.25s
]
Old Stats:
%13s
UL Bytes
|
%4d
# Uploads\r\n",
Catalog.Uploader,commas(User1.Total_ULBytes,buff),User1.Total_ULFiles);
CreditBytes = Credits * Catalog.Bytes;
pl(" - %13s
Bytes
|
%4d
Uploads\r\n",
commas(CreditBytes,buff),Credits);
pl("
=========================|===============\r\n");
if(CreditBytes > User1.Total_ULBytes)
User1.Total_ULBytes = 0;
else
User1.Total_ULBytes = User1.Total_ULBytes - CreditBytes;
if(Credits > User1.Total_ULFiles)
User1.Total_ULFiles = 0;
else
User1.Total_ULFiles -= Credits;
pl("
New Stats:
%13s
UL Bytes
|
%4d
# Uploads\r\n",
commas(User1.Total_ULBytes,buff),User1.Total_ULFiles);
SaveUserSlot(UserSlot);
return;
}
int OnlineFile(Area,Filename)
int Area;
char Filename[];
{
char string1[200],final[200];
int stat,x;
FILE *in;
sprintf(final,"%s%s",File_Area[Area].Path,Filename);
if(access(final,0L)==0)
{
strcpy(Filename,final);
return(1);
}
sprintf(final,"%sDownloads.opt",SystemData.OptionalDirPath);
in=fopen(final,"r");
if(in!=NULL)
{
while(fgets(string1,79,in)!=NULL)
{
string1[strlen(string1)-1] = '\0';
sprintf(final,"%s%s",string1,Filename);
if(access(final,0)==0)
{
fclose(in);
strcpy(Filename,final);
return(1);
}
}
fclose(in);
}
return(0);
}
//***********************************
//***** Find User Slot Number *****
//***********************************
int FindUserSlot(void)
{
int Slot=0;
char string1[255];
GetStr(string1,1);
strcat(string1,"Accounts.INX");
if(!(fd=Open(string1,MODE_OLDFILE)))
return(-2);
NEXTFILE:
stat=Read(fd,string1,31);
if(stat<1)
{
Close(fd);
return(-1); // No Match was found Return Error
}
if(stricmp(string1,Catalog.Uploader)==0)
{
Close(fd);
return(Slot); // Slot Number Found Return Ok
}
Slot++;
goto NEXTFILE;
}
//********************************
//***** Read Catalog Entry *****
//********************************
void GetFileInfo(int Area,int Slot)
{
char string[80],temp[50];
long size,FilePos;
Slot--;
sprintf(temp,"%d",Area);
sprintf(string,"%sCatalog.%s",SystemData.CatalogsPath,temp);
in=Open(string,MODE_OLDFILE);
size=(long)sizeof(struct Catalog);
FilePos=(long)size*(long)Slot;
if(in==0)
{
pl("\r\nNo files uploaded yet.\r\n\r\n");
CloseStuff();
}
stat=Seek(in,FilePos,0);
if(stat!=0)
{
Close(in);
pl("\r\nNumber out of range!\r\n\r\n");
CloseStuff();
}
setmem(&Catalog,sizeof(struct Catalog),NULL);
stat=Read(in,(char *)&Catalog,sizeof(struct Catalog));
if(stat<1)
{
Close(in);
CloseStuff();
}
Close(in);
}
//*********************************
//***** Write Catalog Entry *****
//*********************************
int SaveFileSlot(int Area,int Slot)
{
char string[80];
long size,FilePos;
Slot--;
sprintf(string,"%sCatalog.%d",SystemData.CatalogsPath,Area);
out=Open(string,MODE_OLDFILE);
size=(long)sizeof(struct Catalog);
FilePos=(long)size*(long)Slot;
if(out==0)
{
pl("\r\n No files have been uploaded yet.\r\n\r\n");
CloseStuff();
}
stat=Seek(out,FilePos,0);
if(stat!=0)
{
Close(out);
pl("\r\Cant find that file!\r\n\r\n");
CloseStuff();
}
stat=Write(out,(char *)&Catalog,sizeof(struct Catalog));
if(stat==-1)
{
Close(out);
CloseStuff();
}
Close(out);
return(0);
}
//*****************************
//***** Read User Entry *****
//*****************************
void LoadUserSlot(int UserSlot)
{
char string[80];
long size,FilePos;
GetStr(string,1);
strcat(string,"Accounts.Data");
in=Open(string,MODE_OLDFILE);
size=(long)sizeof(struct User);
FilePos=(long)size*(long)UserSlot;
if(in==0)
CloseStuff();
stat=Seek(in,FilePos,0);
if(stat!=0)
{
Close(in);
CloseStuff();
}
setmem(&User1,sizeof(struct User),NULL);
stat=Read(in,(char *)&User1,sizeof(struct User));
if(stat<1)
{
Close(in);
CloseStuff();
}
Close(in);
}
//******************************
//***** Write User Entry *****
//******************************
void SaveUserSlot(int UserSlot)
{
char string[255];
long size,FilePos;
GetStr(string,1);
strcat(string,"Accounts.Data");
out=Open(string,MODE_OLDFILE);
size=(long)sizeof(struct User);
FilePos=(long)size*(long)UserSlot;
if(out==0)
CloseStuff();
stat=Seek(out,FilePos,0);
if(stat!=0)
{
Close(out);
CloseStuff();
}
stat=Write(out,(char *)&User1,sizeof(struct User));
if(stat==-1)
{
Close(out);
CloseStuff();
}
Close(out);
}
//*************************
//***** Close Stuff *****
//*************************
void CloseStuff(void)
{
SetValue(0,3);
DOOR_DATA=99; strcpy(DOOR_MSG,'\0'); DOORIO();
while(msg=(struct MyMessage *)GetMsg(MyPort)) ReplyMsg((struct Message *)msg);
if(MyPort) DeletePort(MyPort);
exit(0); }
//************************
//***** Door Start *****
//************************
DoorStart(char node[])
{
struct MsgPort *HisPort;
EXIT_FLAG = 0;
sprintf(st,"%s:TEMPEST_DOOR",node);
HisPort = FindPort(st);
if(HisPort==NULL) return (FALSE);
sprintf(MyName,"%s:DOOR_PORT",node);
MyPort = CreatePort(MyName,0L);
if(MyPort==NULL)
{
puts("Cant open port");
return(int)FALSE;
}
DOORIO();
return (int)TRUE;
}
//********************
//***** DoorIO *****
//********************
int DOORIO(void)
{
struct MsgPort *HisPort;
struct MyMessage message;
int UPDATE;
if(EXIT_FLAG) return 0;
UPDATE=0;
HisPort = FindPort(st);
if(HisPort!=NULL)
{
message.Msg.mn_Node.ln_Type = NT_MESSAGE;
message.Msg.mn_Length = sizeof(message);
message.Msg.mn_ReplyPort = MyPort;
if(first)CopyMem(&User,&message.User,sizeof(struct User));
message.car = 0;
message.Data = DOOR_DATA;
message.Value = DOOR_VALUE;
message.IntValue = DOOR_VALUE1;
strcpy(message.text,DOOR_MSG);
strcpy(message.text1,DOOR_MSG1);
PutMsg((struct MsgPort *)HisPort,(struct Message *)&message);
Wait(1 << MyPort->mp_SigBit);
GetMsg(MyPort);
DOOR_DATA = message.Data;
DOOR_VALUE = message.Value;
DOOR_VALUE1 = message.IntValue;
strcpy(DOOR_MSG,message.text);
strcpy(DOOR_MSG1,message.text1);
CopyMem(&message.User,&User,sizeof(struct User));
first=1;
UPDATE=0;
if(message.car) EXIT_FLAG=1;
}
return 0;
}
//*********************************
//***** GetStr (Get String) *****
//*********************************
void GetStr(char s[],int opt)
{ DOOR_DATA=15; DOOR_VALUE=opt; strcpy(s,'\0'); DOORIO(); strcpy(s,DOOR_MSG); }
//*******************
//***** Input *****
//*******************
void input(char mstring[],int len)
{ DOOR_DATA=40; DOOR_VALUE=len; strcpy(DOOR_MSG,mstring); DOORIO();
strcpy(mstring,DOOR_MSG); strcpy(DOOR_MSG,'\0'); strcpy(DOOR_MSG1,'\0'); DROP; }
//**********************
//***** Activity *****
//**********************
void Activity(BYTE act)
{ DOOR_DATA=72; DOOR_VALUE=act; DOORIO(); }
void SetValue(int opt1,int opt)
{ DOOR_DATA=17; DOOR_VALUE1 = opt1; DOOR_VALUE=opt; DOORIO(); }